package homework;
import java.util.Arrays;
/*数组的练习*/
public class Array {
    public static void main(String[] args) {
        //访问
        int[] arr = new int[3];
        System.out.println("数组的长度:"+arr.length);
        System.out.println("数组的第一个元素"+arr[0]);
        arr[0] = 129;
        arr[1] = 142;
        arr[2] = 178;
        System.out.println(arr[2]);
        System.out.println("数组中最后一个元素是:"+arr[arr.length-1]);
        System.out.println("------------------------------------");
        //遍历
        int[] a = new int[10];
        for(int i =0;i<a.length;i++){
            a[i] = (int)(Math.random()*100);
            System.out.println(a[i]);
        }
        System.out.println("------------------------------------");
       //复制
        int[] c = {10,57,68,34,79,32};
        int[] d = Arrays.copyOf(c,10);
        for(int i = 0; i<d.length;i++){
            System.out.println(d[i]);
        }
        System.out.println("-----------------------------------");





    }
}
